package org.networking.tcp.oneToMany;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class Client {
	public static void main(String[] args) throws Exception{
		
		for(int i = 0;i<10000;i++){
			
		
		Socket socket = new Socket("127.0.0.1",888);
		
		//向服务器发起请求（输出流）
		PrintWriter writer = new PrintWriter(socket.getOutputStream());
		String request = "客户端请求";
		writer.println(request);
		writer.flush();
		
		//接收服务器响应（输入流）
		InputStreamReader reader = new InputStreamReader(socket.getInputStream());
		BufferedReader buffer_reader = new BufferedReader(reader);
		String response = buffer_reader.readLine();
		System.out.println(response);
		
		writer.close();
		buffer_reader.close();
		socket.close();
		}
	}
}
